package org.qpcr.community.device.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;
import org.springframework.data.annotation.Id;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

@Getter
@Setter
@Table(name = "device_module")
@Comment("设备模块表-废弃")
@EnableEntityEvent
public class DeviceModuleEntity extends GenericEntity<String> {

    @Override
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @ColumnType(javaType = String.class)
//    @Pattern(regexp = "^[0-9a-zA-Z_\\-]+$", message = "ID只能由数字,字母,下划线和中划线组成", groups = CreateGroup.class)
    @Schema(description = "模块ID")
    @NotBlank(message = "模块ID不能为空", groups = CreateGroup.class)
    @Id
    public String getId() {
        return super.getId();
    }

    @Column(name = "module_code", length = 64)
    @ColumnType(javaType = String.class)
    @Schema(description = "模块编号")
    private String moduleCode;

    @Column(name = "device_id", length = 64)
    @ColumnType(javaType = String.class)
    @Schema(description = "设备编号")
    private String deviceId;

    @Column(name = "prodect_id", length = 64)
    @ColumnType(javaType = String.class)
    @Schema(description = "产品编号")
    private String prodectId;




}
